package com.cetc39.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cetc39.bean.NodeSource;
import com.cetc39.dao.NodeSourceDao;

public class NodeSourceDaoImpl extends HibernateDaoSupport implements NodeSourceDao {

	@Override
	public void save(NodeSource ns) {
		this.getHibernateTemplate().save(ns);
	}

	@Override
	public void update(NodeSource ns) {
		this.getHibernateTemplate().saveOrUpdate(ns);
	}

	@Override
	public List<?> findAll() {
		List<?> nodeSourceList = this.getHibernateTemplate().find("FROM NodeSource");
		return nodeSourceList;
	}

	@Override
	public NodeSource findById(int id) {
		NodeSource ns = this.getHibernateTemplate().get(NodeSource.class, id);
		return ns;
	}

	@Override
	public void delete(int id) {
		NodeSource ns = this.getHibernateTemplate().get(NodeSource.class, id);
		this.getHibernateTemplate().delete(ns);
	}

}
